package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.TbGoodsProtection;
import com.ruoyi.system.mapper.TbGoodsProtectionMapper;
import com.ruoyi.system.service.ITbGoodsProtectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品保障Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-07
 */
@Service
public class TbGoodsProtectionServiceImpl implements ITbGoodsProtectionService 
{
    @Autowired
    private TbGoodsProtectionMapper tbGoodsProtectionMapper;

    /**
     * 查询商品保障
     * 
     * @param id 商品保障主键
     * @return 商品保障
     */
    @Override
    public TbGoodsProtection selectTbGoodsProtectionById(Long id)
    {
        return tbGoodsProtectionMapper.selectTbGoodsProtectionById(id);
    }

    /**
     * 查询商品保障列表
     * 
     * @param tbGoodsProtection 商品保障
     * @return 商品保障
     */
    @Override
    public List<TbGoodsProtection> selectTbGoodsProtectionList(TbGoodsProtection tbGoodsProtection)
    {
        return tbGoodsProtectionMapper.selectTbGoodsProtectionList(tbGoodsProtection);
    }

    /**
     * 新增商品保障
     * 
     * @param tbGoodsProtection 商品保障
     * @return 结果
     */
    @Override
    public int insertTbGoodsProtection(TbGoodsProtection tbGoodsProtection)
    {
        tbGoodsProtection.setCreateTime(DateUtils.getNowDate());
        return tbGoodsProtectionMapper.insertTbGoodsProtection(tbGoodsProtection);
    }

    /**
     * 修改商品保障
     * 
     * @param tbGoodsProtection 商品保障
     * @return 结果
     */
    @Override
    public int updateTbGoodsProtection(TbGoodsProtection tbGoodsProtection)
    {
        tbGoodsProtection.setUpdateTime(DateUtils.getNowDate());
        return tbGoodsProtectionMapper.updateTbGoodsProtection(tbGoodsProtection);
    }

    /**
     * 批量删除商品保障
     * 
     * @param ids 需要删除的商品保障主键
     * @return 结果
     */
    @Override
    public int deleteTbGoodsProtectionByIds(Long[] ids)
    {
        return tbGoodsProtectionMapper.deleteTbGoodsProtectionByIds(ids);
    }

    /**
     * 删除商品保障信息
     * 
     * @param id 商品保障主键
     * @return 结果
     */
    @Override
    public int deleteTbGoodsProtectionById(Long id)
    {
        return tbGoodsProtectionMapper.deleteTbGoodsProtectionById(id);
    }
}
